	function span(ele_parent_id,x) {
			var img_id=ele_parent_id+"_img";
			var span_id=ele_parent_id+"_span";
			var img=document.getElementById(img_id);
			var span=document.getElementById(span_id);
			if(x=="0") {
			span.innerHTML="恭喜可用！";
			img.style.display="inline";
			img.src="img/true3.png";
			}else {
				img.src="img/false3.png";
				span.innerHTML="已存在";
				img.style.display="inline";
			}
		}
		function yanzheng(e) {
			var ele_id=e.target.getAttribute("id");
			var ele_name=e.target.getAttribute("name");
			var ele_parent_id=e.target.parentNode.getAttribute("id");
			var img1_id=ele_parent_id+"_img";
			var span1_id=ele_parent_id+"_span";
			var img1=document.getElementById(img1_id);
			var span1=document.getElementById(span1_id);
			if(ele_id=="username"){
				if(document.getElementById(ele_id).value!="") {
					var request=new XMLHttpRequest();
					url="yanzheng.php";
					request.open("POST",url,"true");
					 request.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=UTF-8");
					request.onreadystatechange=function() {
						if(request.readyState==4){
							if(request.status==200) {
									span(ele_parent_id,request.responseText);
							}
							}
						}
					request.send("username="+document.getElementById(ele_id).value);
				}else {
					img1.src="img/false3.png";
					span1.innerHTML="账号不能为空";
					img1.style.display="inline";
				}
			}else if(ele_id=="psw") {
				var psw=document.getElementById(ele_id).value;
				if(psw.length<6||psw.length>16) {
					img1.src="img/false3.png";
					span1.innerHTML="密码长度不能小于6且不能大于16";
					img1.style.display="inline";
				}else {
					span1.innerHTML="恭喜可用！";
					img1.src="img/true3.png";
					img1.style.display="inline";
				}
			}else if(ele_id=="tel") {
				var tel=document.getElementById(ele_id).value;
				var tel_reg= /^1[3|4|5|8][0-9]{9}$/;
				if(tel.length!=11) {
						img1.src="img/false3.png";
						span1.innerHTML="手机号码为11位数字";
						img1.style.display="inline";
					
				}else {
					if(tel_reg.test(tel)) {
						span1.innerHTML="恭喜可用！";
						img1.src="img/true3.png";
						img1.style.display="inline";
					}else {
					img1.src="img/false3.png";
					span1.innerHTML="手机格式不正确";
					img1.style.display="inline";
					}
				}
			}
			} 
			window.onload=function() {
				var element=document.getElementsByClassName("inpu");
				for(var i=0;i<element.length;i++) {
							element[i].onblur=yanzheng;
					}
				var submi=document.getElementById("submi");
			}